package com.basketball.service.impl;

import com.basketball.entity.Record;
import com.basketball.repository.PlayerRepository;
import com.basketball.repository.RecordRepository;
import com.basketball.service.RecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class RecordServiceImpl implements RecordService {
    @Autowired
    private RecordRepository recordRepository;

    @Override
    public void addRecord(Record record) {
        recordRepository.save(record);
    }

    @Override
    public void updateRecord(Record record)  {
        recordRepository.saveAndFlush(record);
    }

    @Override
    public List<Record> getRecordByDate(String eventDate) {
        return recordRepository.getRecordByDate(eventDate);
    }

}
